Object.defineProperty(exports, "__esModule", {
  value: true
});
var _def_GravityPlatform = function () {
  function _creator() {}
  _creator.GA_Init = function (t) {
    console.error("引力引擎 开始初始化 ", t);
    _creator.clientId = t;
    var o = {
      accessToken: _creator.accessToken,
      clientId: _creator.clientId,
      autoTrack: {
        appLaunch: true,
        appShow: true,
        appHide: true
      },
      name: "ge",
      debugMode: _creator.debugMode
    };
    _creator.GravityAnalytics = new GravityAnalyticsAPI(o);
    _creator.GravityAnalytics.setupAndStart();
    var n = cc.sys.localStorage.getItem("GA_initialize");
    n && "" != n || _creator.GA_initialize();
  };
  _creator.GA_initialize = function () {
    _creator.GravityAnalytics.initialize({
      name: _creator.clientId,
      version: _creator.version,
      openid: _creator.clientId
    }).then(function (e) {
      console.error("引力引擎 initialize success ", e);
      cc.sys.localStorage.setItem("GA_initialize", true);
    }).catch(function (e) {
      console.error("引力引擎 initialize failed, error is ", e);
    });
  };
  _creator.GA_initializeWithHistoryUserInfo = function () {
    var t = Date.now();
    console.error("引力引擎 GA_initializeWithHistoryUserInfo create_time ", t);
    console.error("引力引擎 GA_initializeWithHistoryUserInfo GravityPlatform.GravityAnalytics ", _creator.GravityAnalytics);
    _creator.GravityAnalytics.initializeWithHistoryUserInfo({
      name: _creator.clientId,
      version: _creator.version,
      openid: _creator.clientId
    }, {
      company: "bytedance",
      create_time: t
    }).then(function (e) {
      console.error("引力引擎 initializeWithHistoryUserInfo success ", e);
    }).catch(function (e) {
      console.error("引力引擎 initializeWithHistoryUserInfo failed, error is ", e);
    });
  };
  _creator.GA_adShowEvent = function (t) {
    undefined === t && (t = "");
    if (cc.sys.platform != cc.sys.BYTEDANCE_GAME) {
      console.error("引力引擎 上报广告展示事件  ");
      _creator.GravityAnalytics.adShowEvent("reward", _creator.videoId, {
        custom_param: "用户查看视频"
      });
    } else {
      console.error("引力引擎 说抖音不用接");
    }
  };
  _creator.GravityAnalytics = null;
  _creator.accessToken = "aczWfZkal4HiIL2nhtmjoFwG8mrisdod";
  _creator.clientId = "";
  _creator.version = 1;
  _creator.debugMode = "none";
  _creator.videoId = "";
  return _creator;
}();
exports.default = _def_GravityPlatform;